package com.zengqingfa.designpattern.behavior.strategy;

import com.zengqingfa.designpattern.behavior.strategy.impl.StrategyImpl1;
import com.zengqingfa.designpattern.behavior.strategy.impl.StrategyImpl2;

/**
 *
 * @fileName: StrategyContext
 * @author: zengqf3
 * @date: 2021-4-9 11:31
 * @description:
 */
public class StrategyContext {

    Strategy strategy;

    public StrategyContext(Strategy strategy) {
        this.strategy = strategy;
    }

    public void deal() {
        strategy.process();
    }

    public static void main(String[] args) {
        StrategyContext context1 = new StrategyContext(new StrategyImpl1());
        context1.deal();
        System.out.println("==================");
        StrategyContext context2 = new StrategyContext(new StrategyImpl2());
        context2.deal();
    }
}
